const cloud = require('wx-server-sdk')
cloud.init({
})
const db = cloud.database()
const _ = db.command
exports.main = async (event, context) => {
  try {
    return await db.collection(event.dataname).where({
      [event.name]:event.value
    }).update({
      data:event.data,
      success: function(res) {
        console.log(res)
      }
    })
   
  } catch(e) {
    console.error(e)
  }
}